In [1]:
import os
import lasio
In [2]:
las = lasio.read(os.path.join('..', 'tests', 'examples', 'sample.las'))
we'll use this LAS file as an example:
In [3]:
print las._text
Now use the ExcelConverter
object to produce an Excel spreadsheet:
In [4]:
lasio.ExcelConverter(las).write('example.xlsx')
we can import this spreadsheet back into Python directly using pandas
:
In [5]:
import pandas
The spreadsheet has two sheets, one called "Header" with the header information from each section:
In [6]:
xls_header_sheet = pandas.read_excel('example.xlsx', sheetname='Header')
In [7]:
xls_header_sheet
Out[7]:
and another called "Curves" containing the data itself:
In [8]:
xls_data_sheet = pandas.read_excel('example.xlsx', sheetname='Curves')
In [9]:
xls_data_sheet
Out[9]:
If you want to further modify the openpyxl.Workbook
object, you can access it like so:
In [10]:
converter = lasio.ExcelConverter(las)
In [11]:
type(converter.workbook)
Out[11]:
finally take a look at some screenshots of the Excel file itself:
In [ ]: